package controller;

import controller.dialog.DialogExit;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import model.TAGS;
import rmi.RMIServer;

/**
 * FXML Controller class
 * Controller do dialog de finalização da aplicação
 * @author Adriano
 */
public class DialogController implements Initializable {

    @Override
    public void initialize(URL url, ResourceBundle rb) {
        // TODO
    }

    /**Finalizar o Jogo*/
    public void sim(ActionEvent event) {
        if (TAGS.NAME.length() > 0) {
            try {
                RMIServer.getInstacia().getPlayJogador().removerJogador(TAGS.NAME);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        System.exit(0);
    }
    /**Finalizar o dialog*/
    public void nao(ActionEvent event) throws IOException, Throwable {
       DialogExit.getIntancia().close();
    }
}
